#include <cstdio>
#include <memory.h>

int main( )
{
    int i, j;
    double p, game[ 6 ][ 6 ], set[ 8 ][ 7 ], deuce, g, s, tie[ 8 ][ 8 ], t, deuce2, ss;
    while ( scanf("%lf", &p) && p != -1 )
    {
        memset( game, 0, sizeof( game ) );
        game[ 0 ][ 0 ] = 1;
        for ( i = 0; i < 5; i++ )
            for ( j = 0; j < 4; j++ )
            {
                if ( i )
                    game[ i ][ j ] += game[ i - 1 ][ j ] * p;
                if ( j && i != 4 )
                    game[ i ][ j ] += game[ i ][ j - 1 ] * ( 1 - p );
            }
        deuce = ( p * game[ 2 ][ 3 ] + ( 1 - p ) * game[ 3 ][ 2 ] ) / ( 1 - 2 * p * ( 1 - p ) );
        g = game[ 4 ][ 0 ] + game[ 4 ][ 1 ] + game[ 4 ][ 2 ] + deuce * p * p;
        memset( set, 0, sizeof( set ) );
        set[ 0 ][ 0 ] = 1;
        for ( i = 0; i < 8; i++ )
            for ( j = 0; j < 7; j++ )
            {
                if ( i && !( i > 6 && i - j > 2 ) && !( j >= 6 && j - i >= 1 ) )
                    set[ i ][ j ] += set[ i - 1 ][ j ] * g;
                if ( j && !( i >= 6 && i - j >= 1 ) && !( j > 6 && j - i > 2 ) )
                    set[ i ][ j ] += set[ i ][ j - 1 ] * ( 1 - g );
            }
        s = 0;
        for ( i = 6; i < 8; i++ )
            for ( j = 0; j <= i - 2; j++ )
                s += set[ i ][ j ];
        memset( tie, 0, sizeof( tie ) );
        tie[ 0 ][ 0 ] = 1;
        for ( i = 0; i < 8; i++ )
            for ( j = 0; j < 7; j++ )
            {
                if ( i )
                    tie[ i ][ j ] += tie[ i - 1 ][ j ] * p;
                if ( j && ( i != 7 ) )
                    tie[ i ][ j ] += tie[ i ][ j - 1 ] * ( 1 - p );
            }
        t = 0;
        for ( i = 0; i <= 5; i++ ) t += tie[ 7 ][ i ];
        deuce2 = tie[ 6 ][ 6 ] / ( 1 - 2 * p * ( 1 - p ) );
        t += deuce2 * p * p;
        ss = s + t * set[ 6 ][ 6 ];
        printf("%.11lf %.11lf %.11lf\n", g, ss, ss * ss + ( 1 - ss ) * ss * ss * 2);
    }
    return 0;
}
